//
//  Singleton.h
//  WeChat
//
//  Created by 吴高烽 on 16/5/22.
//  Copyright © 2016年 吴高烽. All rights reserved.
// .h
#define singleton_interface(class)                      \
+ (instancetype)share##class;
// .m
#define singleton_implementation(class)                 \
static class *_instance ;                               \
\
+(instancetype)allocWithZone:(struct _NSZone *)zone{    \
    static dispatch_once_t onceToken;                   \
    dispatch_once(&onceToken, ^{                        \
    _instance =[super allocWithZone:zone];              \
    });                                                 \
\
    return _instance;                                   \
}                                                       \
\
+(instancetype)share##class{                            \
    if(!_instance){                                     \
    _instance =[[class alloc]init];                     \
    }                                                   \
    return _instance;                                   \
}